<!DOCTYPE html>
<html class="no-js" lang="zh">
  <head>
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="alternate" href="https://www.desgard.com" hreflang="pt-BR">
<link href="http://gmpg.org/xfn/11" rel="profile">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="theme-color" content="#005344">
<title>Guardia · 瓜地</title>
<meta name="google-site-verification" content="zS1dSn20XtA4FJYEOQLXqI0boxZdMnJ2g3beje-cl20">
<meta name="description" content="I write many code to write less code.💻 - Página 4 ">
<meta name="keywords" content="">
<!-- Social: Facebook / Open Graph -->
<meta property="og:url" content="https://www.desgard.com/page/4/">
<meta property="og:title" content="Gua | 瓜地   - Page 4">
<meta property="og:description" content="I write many code to write less code.💻 - Página 4 ">
<meta property="og:site_name" content="Desgard_Duan">
<meta property="og:locale" content="pt_BR">
<meta property="og:type" content="website">
<meta property="og:author" content="https://www.facebook.com/desgard.duan">
<meta property="og:image" content="https://www.desgard.com">
<!-- Social: Twitter -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@nandomoreirame">
<meta name="twitter:domain" content="https://www.desgard.com">
<meta name="twitter:title" content="Gua | 瓜地   - Page 4">
<meta name="twitter:description" content="I write many code to write less code.💻 - Página 4 ">
<meta name="twitter:image:src" content="https://www.desgard.com">
<!-- Favicons -->
<link rel="apple-touch-icon" sizes="114x114" href="https://www.desgard.com/assets/ico/apple-touch-icon-114-516f4e19976b9e4dbb77ad9b576831fe.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://www.desgard.com/assets/ico/apple-touch-icon-72-5409b2df229305703caf583d86c845ab.png">
<link rel="apple-touch-icon" href="https://www.desgard.com/assets/ico/apple-touch-icon-57-aa873e019cf659e0d4e6a0b5bb9f379d.png">
<link rel="shortcut icon" href="https://www.desgard.com/assets/ico/favicon-4298be3d3fbe23e18d65bded9d930899.png">
<!-- rel prev and next -->
  <link rel="prev" href="https://www.desgard.com/page/3">
  <link rel="next" href="https://www.desgard.com/page/5">
<!-- Canonical link tag -->
<link rel="canonical" href="https://www.desgard.com/page/4/">
<link rel="alternate" type="application/rss+xml" title="Gua" href="https://www.desgard.com/feed.xml">
<link rel="stylesheet" href="/assets/main-0b7b828712f4c43b75bba4861c907bb1.css">
<script src="/assets/modernizr-custom-cb807611a3e262b2eac59444cbab74d6.js" data-cfasync="false"></script>
<script src="/assets/js/jquery-3.1.js"></script>
<script src="/assets/js/jquery.rotate.js"></script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Website",
  "publisher": "www.desgard.com",
  "url": "http://www.desgard.com/",
  "description": "瓜地"
}
</script>
<script type="text/javascript">
  var disqus_shortname = 'desgard',
      baseurl          = '';
</script>
<!--
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-52446115-1']);
_gaq.push(['_trackPageview']);
(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>-->
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?c5a8123bc51782a3083a631ed9ff50e4";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        inlineMath: [ ['$','$'] ],
        displayMath: [ ['$$','$$'] ],
        processEscapes: true
      }
    });
  </script>
  </head>
  <body class="page-template home">
    <header class="header alt">
  <div class="container">
    <h1><a href="/"><strong>desgard</strong>.com</a></h1>
    <nav class="navbar">
      <ul>
        <li><a href="/">Home</a></li>
        <li><a href="#!" data-modal="modalSearch"><i class="fa fa-search"></i></a></li>
        <li><a href="/comment " target="_blank"><i class="fa fa-comments"></i></a></li>
        <li><a href="/feed.xml" target="_blank"><i class="fa fa-feed"></i></a></li>
      </ul>
    </nav>
  </div>
</header>
      <section class="banner">
  <img src="/assets/images/logo-new.png" alt="author thumb" class="dot animated hinge fadeInDown" id="avartor" width="120px">
  <h2 class="animated hinge fadeInDown" itemscope itemtype="http://schema.org/Person"><strong itemprop="name">Gua</strong><em itemprop="jobTitle">iOS Dev</em> and try everything!</h2>
  <nav class="actions">
    <a href="/about" class="button ghost">About</a>
    <a href="http://project.desgard.com" class="button ghost">Project</a>
  </nav>
</section>
<script>
    $("#avartor").mouseover();
</script>
    <main class="wrapper container" itemprop="mainContentOfPage" itemscope="itemscope" itemtype="http://schema.org/Blog">
<article class="post" itemscope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
  <header class="post-header">
    <h1 class="post-title"><a href="/weak/" title="Permalink to weak 弱引用的实现方式">weak 弱引用的实现方式</a></h1>
  </header>
  <p><a href="/weak/" title="Permalink to weak 弱引用的实现方式" class="read-more">对于 runtime 的分析还有很长的路，最近在写 block 系列的同时，也回顾一下之前疏漏的细节知识。这篇文章是关于 weak 的具体实现的学习笔记。 runtime 对 __weak 弱引用处理方式 切入主题，这里笔者使用的 runtime 版本为 objc4-680.tar.gz。...</a></p>
  <footer class="post-meta">
    <time datetime="2016-09-11">
      <i class="fa fa-calendar-o"></i> 2016-09-11
    </time>
    <span>
      <i class="fa fa-comments"></i> <a href="/weak/#container">Leave a comment</a>
    </span>
    <span>
    </span>
  </footer>
</article>
<article class="post" itemscope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
  <header class="post-header">
    <h1 class="post-title"><a href="/SDWebImage1/" title="Permalink to SDWebImage Source Probe: WebCache">SDWebImage Source Probe: WebCache</a></h1>
  </header>
  <p><a href="/SDWebImage1/" title="Permalink to SDWebImage Source Probe: WebCache" class="read-more">最近两天，在完成工作业务之余，除了看书，自己也要开始深入的阅读经典的源码。来完善我的 iOS 源码探求 系列文章。 对源码的阅读是一个长久的学习过程，我会将业务中最常用的一些经典三方库拿出来进行学习。这一点我很敬佩 @Draveness 的精神，并向他看齐。 SDWebImage 简单介绍 SDWebImage 根据官方文档，其实就是提供了以下功能： Asynchronous image downloader with...</a></p>
  <footer class="post-meta">
    <time datetime="2016-09-04">
      <i class="fa fa-calendar-o"></i> 2016-09-04
    </time>
    <span>
      <i class="fa fa-comments"></i> <a href="/SDWebImage1/#container">Leave a comment</a>
    </span>
    <span>
    </span>
  </footer>
</article>
<article class="post" itemscope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
  <header class="post-header">
    <h1 class="post-title"><a href="/block2/" title="Permalink to 浅谈 block（2） - 截获变量方式">浅谈 block（2） - 截获变量方式</a></h1>
  </header>
  <p><a href="/block2/" title="Permalink to 浅谈 block（2） - 截获变量方式" class="read-more">本文会通过 clang 的 -rewrite-objc 选项来分析 block 的 C 转换源代码。其分析方式在该系列上一篇有详细介绍。请先阅读 浅谈 block（1） - clang 改写后的 block...</a></p>
  <footer class="post-meta">
    <time datetime="2016-09-03">
      <i class="fa fa-calendar-o"></i> 2016-09-03
    </time>
    <span>
      <i class="fa fa-comments"></i> <a href="/block2/#container">Leave a comment</a>
    </span>
    <span>
    </span>
  </footer>
</article>
<article class="post" itemscope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
  <header class="post-header">
    <h1 class="post-title"><a href="/objc_msgSend2/" title="Permalink to objc_msgSend消息传递学习笔记 - 消息转发">objc_msgSend消息传递学习笔记 - 消息转发</a></h1>
  </header>
  <p><a href="/objc_msgSend2/" title="Permalink to objc_msgSend消息传递学习笔记 - 消息转发" class="read-more">该文是 objc_msgSend消息传递学习笔记 - 对象方法消息传递流程 的基础上继续探究源码，请先阅读上文。 消息转发机制(message forwarding) Objective-C 在调用对象方法的时候，是通过消息传递机制来查询且执行方法。如果想令该类能够理解并执行方法，必须以程序代码实现出对应方法。但是，在编译期间向类发送了无法解读的消息并不会报错，因为在 runtime 时期可以继续向类添加方法，所以编译器在编译时还无法确认类中是否已经实现了消息方法。 当对象接受到无法解读的消息后，就会启动消息转发机制，并且我们可以由此过程告诉对象应该如何处理位置消息。 本文的研究目标：当 Class 对象的...</a></p>
  <footer class="post-meta">
    <time datetime="2016-08-27">
      <i class="fa fa-calendar-o"></i> 2016-08-27
    </time>
    <span>
      <i class="fa fa-comments"></i> <a href="/objc_msgSend2/#container">Leave a comment</a>
    </span>
    <span>
    </span>
  </footer>
</article>
<article class="post" itemscope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
  <header class="post-header">
    <h1 class="post-title"><a href="/block1/" title="Permalink to 浅谈 block（1） - clang 改写后的 block 结构">浅谈 block（1） - clang 改写后的 block 结构</a></h1>
  </header>
  <p><a href="/block1/" title="Permalink to 浅谈 block（1） - clang 改写后的 block 结构" class="read-more">这几天为了巩固知识，从 iOS 的各个知识点开始学习，希望自己对每一个知识理解的更加深入的了解。这次来分享一下 block 的学习笔记。 block 简介 block 被当做扩展特性而被加入 GCC 编译器中的。自从 OS X 10.4 和...</a></p>
  <footer class="post-meta">
    <time datetime="2016-08-21">
      <i class="fa fa-calendar-o"></i> 2016-08-21
    </time>
    <span>
      <i class="fa fa-comments"></i> <a href="/block1/#container">Leave a comment</a>
    </span>
    <span>
    </span>
  </footer>
</article>
<article class="post" itemscope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
  <header class="post-header">
    <h1 class="post-title"><a href="/copy/" title="Permalink to 从经典问题来看 Copy 方法">从经典问题来看 Copy 方法</a></h1>
  </header>
  <p><a href="/copy/" title="Permalink to 从经典问题来看 Copy 方法" class="read-more">在初学 iOS 的时候，可能会被灌输这么一个常识，切记 NSString 的 property 的修饰变量要写作 copy ，而不是 strong，那么这是为什么？ 经典面试题：为什么 NSString 类型成员变量的修饰属性用 copy 而不是...</a></p>
  <footer class="post-meta">
    <time datetime="2016-08-11">
      <i class="fa fa-calendar-o"></i> 2016-08-11
    </time>
    <span>
      <i class="fa fa-comments"></i> <a href="/copy/#container">Leave a comment</a>
    </span>
    <span>
    </span>
  </footer>
</article>
<nav class="pagination" role="pagination">
    <a class="older-posts" href="/page/5/" title="Articles old">Last</a>
  <span class="page-number">4 / 6</span>
      <a class="newer-posts" href="/page/3/" title="Articles new">Next</a>
</nav>
    </main>
<footer class="footer">
  <div class="container">
    <ul class="icons">
      <li>
        <a href="https://github.com/desgard" class="icon-github" target="_blank">
          <i class="fa fa-github"></i>
        </a>
      </li>
      <li>
        <a href="https://www.facebook.com/desgard.duan" class="icon-facebook" target="_blank">
          <i class="fa fa-facebook"></i>
        </a>
      </li>
      <li>
        <a href="https://twitter.com/Desgard_Duan" class="icon-twitter" target="_blank">
          <i class="fa fa-twitter"></i>
        </a>
      </li>
      <li>
        <a href="https://stackoverflow.com/users/6119149/desgard-duan" class="icon-github" target="_blank">
          <i class="fa fa-stack-overflow"></i>
        </a>
      </li>
      <li>
        <a href="https://weibo.com/desgard" class="icon-instagram" target="_blank">
          <i class="fa fa-weibo"></i>
        </a>
      </li>
    </ul>
    <p>
      <q>I write many code to write less code.💻</q>
      <small>– Gua</small>
    </p>
    <small class="clearfix">
      Powered by <a href="http://jekyllrb.com" target="_blank">Jekyll</a> • <a href="https://github.com/desgard" target="_blank">Open source <i class="fa fa-heart"></i></a>
    </small>
  </div>
</footer>
<a class="scroll-up fa fa-chevron-up bounce" href="#" data-position="0"></a>
<div id="modalSearch" class="modal">
  <div class="modal__overlay"></div>
  <div class="modal__content">
    <a href="#!" class="modal-close" data-modal-close>&times;</a>
    <div class="search-container">
      <input type="text" id="search-input" placeholder="Search articles">
      <ul id="results-container"></ul>
    </div>
  </div>
</div>
    <script src="/assets/main-52d417e8a6ff9f5b168386d37c96338a.js"></script>
  </body>
  <script>
    var link = "" ;
    var os = function() {  
      var ua = navigator.userAgent,  
      isWindowsPhone = /(?:Windows Phone)/.test(ua),  
      isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone,   
      isAndroid = /(?:Android)/.test(ua),   
      isFireFox = /(?:Firefox)/.test(ua),   
      isChrome = /(?:Chrome|CriOS)/.test(ua),  
      isTablet = /(?:iPad|PlayBook)/.test(ua) || (isAndroid && !/(?:Mobile)/.test(ua)) || (isFireFox && /(?:Tablet)/.test(ua)),  
      isPhone = /(?:iPhone)/.test(ua) && !isTablet,  
      isPc = !isPhone && !isAndroid && !isSymbian;  
      return {  
        isTablet: isTablet,  
        isPhone: isPhone,  
        isAndroid : isAndroid,  
        isPc : isPc  
      };  
    }();  
    if (link.length > 0) {
      if (os.isAndroid || os.isPhone) {
        location.replace(link);
      }
    }
  </script>
</html>